/////////////////////////////////////////////////////////////////////////
//
// Amuse Engine SDK - geometry/mesh
// Copyright( c) 2015.  All Rights Reserved
//
// File:		AEMeshBuffer.inl
// Author:		Gianluca Belardelli
// Date:		10/02/2015
//
/////////////////////////////////////////////////////////////////////////
#ifndef _AEMESHBUFFER_INL_
#define _AEMESHBUFFER_INL_

AE_FORCEINLINE void AEMeshBuffer::SetPrimitiveType( AEPrimitiveType ePrimType )
{
	m_ePrimType = ePrimType;
}

AE_FORCEINLINE AEPrimitiveType AEMeshBuffer::GetPrimitiveType( void ) const
{
	return (AEPrimitiveType)m_ePrimType;
}

AE_FORCEINLINE void AEMeshBuffer::GetVertexDescriptor( AEVertexDescriptor &vdDescr ) const
{
	vdDescr = m_vdVertexDescr;
}

AE_FORCEINLINE AEUINT32 AEMeshBuffer::GetStreamMask( void ) const
{
	AEUINT32 nMask = m_vdVertexDescr.GetStreamMask();
	return ( GetIndexCount() > 0 ) ? ( nMask | AEVERTEXSTREAM_INDEXBUFFER ) : nMask;
}

AE_FORCEINLINE AEUINT32 AEMeshBuffer::GetVertexUsageFlags( void ) const 
{
	return m_nMemUsageFlagVertices;
}

AE_FORCEINLINE AEUINT32 AEMeshBuffer::GetIndexUsageFlags( void ) const
{
	return m_nMemUsageFlagIndices;
}

AE_FORCEINLINE void AEMeshBuffer::GetDoubleBuffering( AEBOOL32 &bVerticesDoubleBuffered, AEBOOL32 &bIndicesDoubleBuffered, AEBOOL32 &bDoubleBufferingFromFile ) const
{
	bVerticesDoubleBuffered = m_bVerticesDoubleBuffered;
	bIndicesDoubleBuffered = m_bIndicesDoubleBuffered;
	bDoubleBufferingFromFile = m_bDoubleBufferingFromFile;
}

AE_FORCEINLINE void AEMeshBuffer::SetDoubleBuffering( AEBOOL32 bVerticesDoubleBuffered, AEBOOL32 bIndicesDoubleBuffered, AEBOOL32 bDoubleBufferingFromFile )
{
	m_bVerticesDoubleBuffered = bVerticesDoubleBuffered;
	m_bIndicesDoubleBuffered = bIndicesDoubleBuffered;
	m_bDoubleBufferingFromFile = bDoubleBufferingFromFile;
}

AE_FORCEINLINE AEINT32 AEMeshBuffer::GetVertexCount( void ) const
{
	return m_nAllocVertexCount;
}

AE_FORCEINLINE AEINT32 AEMeshBuffer::GetIndexCount( void ) const
{
	return m_nAllocIndexCount;
}

AE_FORCEINLINE AEBOOL32 AEMeshBuffer::AreVerticesLocked( void ) const
{
	return m_bVerticesLocked;
}

AE_FORCEINLINE AEBOOL32 AEMeshBuffer::AreIndicesLocked( void ) const
{
	return m_bIndicesLocked;
}

AE_FORCEINLINE void AEMeshBuffer::SetBaseTexture( AETexture *lpTextureObject )
{
	int i;

	for( i=0; i<AEMAX_MESHBUFFER_TEXCOORDS; i++ )
		SetChannelTexture( lpTextureObject, i );
}

AE_FORCEINLINE AETexture *AEMeshBuffer::GetBaseTexture( void ) const
{
	return m_lpChannelTex[0];
}

AE_FORCEINLINE void AEMeshBuffer::SetChannelTexture( AETexture *lpTextureObject, AEINT32 nChannel )
{
	AEASSERT( nChannel >= 0 && nChannel < AEMAX_MESHBUFFER_TEXCOORDS );
	m_lpChannelTex[ nChannel ] = lpTextureObject;
}

AE_FORCEINLINE AETexture *AEMeshBuffer::GetChannelTexture( AEINT32 nChannel ) const
{
	AEASSERT( nChannel >= 0 && nChannel < AEMAX_MESHBUFFER_TEXCOORDS );
	return m_lpChannelTex[ nChannel ];
}

AE_FORCEINLINE void AEMeshBuffer::SetDefaultTransparency( AETransparencyType eTransp )
{
}

AE_FORCEINLINE AETransparencyType AEMeshBuffer::GetDefaultTransparency( void ) const
{
}

AE_FORCEINLINE void AEMeshBuffer::EnableDefaultZBufferWriting( AEBOOL32 bStatus )
{
}

AE_FORCEINLINE AEBOOL32 AEMeshBuffer::IsDefaultZBufferWritingEnabled( void ) const
{
}

AE_FORCEINLINE void AEMeshBuffer::SetDefaultCullMode( AECullMode eCullMode )
{
}

AE_FORCEINLINE AECullMode AEMeshBuffer::GetDefaultCullMode( void ) const
{
}

/*
AE_FORCEINLINE void AEMeshBuffer::SetDefaultRenderState( const VSimpleRenderState_t &state )
{
	m_rsRenderState=state;
}

AE_FORCEINLINE VSimpleRenderState_t AEMeshBuffer::GetDefaultRenderState() const
{
	return m_rsRenderState;
}

AE_FORCEINLINE void AEMeshBuffer::SetDefaultTechnique(VCompiledTechnique *pTechnique)
{
	m_spDefaultTechnique = pTechnique;
}

AE_FORCEINLINE VCompiledTechnique *AEMeshBuffer::GetDefaultTechnique() const
{
	return m_spDefaultTechnique;
}

*/

AE_FORCEINLINE void AEMeshBuffer::SetUseProjectionMatrix( AEBOOL32 bStatus )
{
	m_bUseProjection = ( bStatus == AETRUE );
}

AE_FORCEINLINE AEBOOL32 AEMeshBuffer::GetUseProjectionMatrix( void ) const
{
	return m_bUseProjection;
}

AE_FORCEINLINE AEVertexBuffer *AEMeshBuffer::GetVertexBuffer( void )
{
	return m_spVertexBuffer;
}

AE_FORCEINLINE AEIndexBuffer *AEMeshBuffer::GetIndexBuffer( void )
{
	return m_spIndexBuffer;
}

#endif // _AEMESHBUFFER_INL_
